﻿// -----------------------------------------------------------------------
//  <copyright file="IStoreContract.cs" company="柳柳软件">
//      Copyright (c) 2014-2015 66SOFT. All rights reserved.
//  </copyright>
//  <site>http://www.66soft.net</site>
//  <last-Updateor>郭明锋</last-Updateor>
//  <last-date>2015-12-07 17:41</last-date>
// -----------------------------------------------------------------------

using System;
using System.Linq;
using System.Linq.Expressions;
using System.Threading.Tasks;

using OSharp.Core.Dependency;
using OSharp.Utility.Data;

using ZH.JY.Store.Dtos;
using ZH.JY.Store.Models;


namespace ZH.JY.Store
{
    /// <summary>
    /// 业务契约——销售模块
    /// </summary>
    public interface IStoreContract : IScopeDependency
    {
        #region 客户信息业务

        /// <summary>
        /// 获取 客户信息查询数据集
        /// </summary>
        IQueryable<Customer> Customers { get; }

        /// <summary>
        /// 检查客户信息信息是否存在
        /// </summary>
        /// <param name="predicate">检查谓语表达式</param>
        /// <param name="id">更新的客户信息编号</param>
        /// <returns>客户信息是否存在</returns>
        Task<bool> CheckCustomerExists(Expression<Func<Customer, bool>> predicate, int id = 0);

        /// <summary>
        /// 添加客户信息信息
        /// </summary>
        /// <param name="dtos">要添加的客户信息DTO信息</param>
        /// <returns>业务操作结果</returns>
        Task<OperationResult> CreateCustomers(params CustomerInputDto[] dtos);

        /// <summary>
        /// 更新客户信息信息
        /// </summary>
        /// <param name="dtos">包含更新信息的客户信息DTO信息</param>
        /// <returns>业务操作结果</returns>
        Task<OperationResult> UpdateCustomers(params CustomerInputDto[] dtos);

        /// <summary>
        /// 删除客户信息信息
        /// </summary>
        /// <param name="ids">要删除的客户信息编号</param>
        /// <returns>业务操作结果</returns>
        Task<OperationResult> DeleteCustomers(params int[] ids);

        #endregion

        #region 产品信息业务

        /// <summary>
        /// 获取 产品信息查询数据集
        /// </summary>
        IQueryable<Product> Products { get; }

        /// <summary>
        /// 检查产品信息信息是否存在
        /// </summary>
        /// <param name="predicate">检查谓语表达式</param>
        /// <param name="id">更新的产品信息编号</param>
        /// <returns>产品信息是否存在</returns>
        Task<bool> CheckProductExists(Expression<Func<Product, bool>> predicate, int id = 0);

        /// <summary>
        /// 添加产品信息信息
        /// </summary>
        /// <param name="dtos">要添加的产品信息DTO信息</param>
        /// <returns>业务操作结果</returns>
        Task<OperationResult> CreateProducts(params ProductInputDto[] dtos);

        /// <summary>
        /// 更新产品信息信息
        /// </summary>
        /// <param name="dtos">包含更新信息的产品信息DTO信息</param>
        /// <returns>业务操作结果</returns>
        Task<OperationResult> UpdateProducts(params ProductInputDto[] dtos);

        /// <summary>
        /// 删除产品信息信息
        /// </summary>
        /// <param name="ids">要删除的产品信息编号</param>
        /// <returns>业务操作结果</returns>
        Task<OperationResult> DeleteProducts(params int[] ids);

        #endregion

        #region 出货记录信息业务

        /// <summary>
        /// 获取 出货记录信息查询数据集
        /// </summary>
        IQueryable<Shipment> Shipments { get; }

        /// <summary>
        /// 检查出货记录信息信息是否存在
        /// </summary>
        /// <param name="predicate">检查谓语表达式</param>
        /// <param name="id">更新的出货记录信息编号</param>
        /// <returns>出货记录信息是否存在</returns>
        Task<bool> CheckShipmentExists(Expression<Func<Shipment, bool>> predicate, int id = 0);

        /// <summary>
        /// 添加出货记录信息信息
        /// </summary>
        /// <param name="dtos">要添加的出货记录信息DTO信息</param>
        /// <returns>业务操作结果</returns>
        Task<OperationResult> CreateShipments(params ShipmentInputDto[] dtos);

        /// <summary>
        /// 更新出货记录信息信息
        /// </summary>
        /// <param name="dtos">包含更新信息的出货记录信息DTO信息</param>
        /// <returns>业务操作结果</returns>
        Task<OperationResult> UpdateShipments(params ShipmentInputDto[] dtos);

        /// <summary>
        /// 删除出货记录信息信息
        /// </summary>
        /// <param name="ids">要删除的出货记录信息编号</param>
        /// <returns>业务操作结果</returns>
        Task<OperationResult> DeleteShipments(params int[] ids);

        #endregion

        #region 入户记录信息业务

        /// <summary>
        /// 获取 入户记录信息查询数据集
        /// </summary>
        IQueryable<StockingLog> StockingLogs { get; }

        /// <summary>
        /// 检查入户记录信息信息是否存在
        /// </summary>
        /// <param name="predicate">检查谓语表达式</param>
        /// <param name="id">更新的入户记录信息编号</param>
        /// <returns>入户记录信息是否存在</returns>
        Task<bool> CheckStockingLogExists(Expression<Func<StockingLog, bool>> predicate, int id = 0);

        /// <summary>
        /// 添加入户记录信息信息
        /// </summary>
        /// <param name="dtos">要添加的入户记录信息DTO信息</param>
        /// <returns>业务操作结果</returns>
        Task<OperationResult> CreateStockingLogs(params StockingLogInputDto[] dtos);

        /// <summary>
        /// 更新入户记录信息信息
        /// </summary>
        /// <param name="dtos">包含更新信息的入户记录信息DTO信息</param>
        /// <returns>业务操作结果</returns>
        Task<OperationResult> UpdateStockingLogs(params StockingLogInputDto[] dtos);

        /// <summary>
        /// 删除入户记录信息信息
        /// </summary>
        /// <param name="ids">要删除的入户记录信息编号</param>
        /// <returns>业务操作结果</returns>
        Task<OperationResult> DeleteStockingLogs(params int[] ids);

        #endregion

    }
}